﻿using Terraria.GameContent.Creative;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria;
using EAS.Content.Projectiles;
using EAS.Common.Players;

namespace EAS.Content.Items
{
    public class WormRemote : ModItem
    {
        public override void SetStaticDefaults()
        {
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
        }
        public override void SetDefaults()
        {
            Item.height = 28;
            Item.width = 28;
            Item.accessory = true;
            Item.rare = ItemRarityID.Master;
            Item.value = Item.sellPrice(0, 10, 0, 0);
            Item.master = true;
        }
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.GetDamage(DamageClass.Summon) += 0.12f;
            player.maxTurrets += 3;
            player.maxMinions++;
            if (!hideVisual)
            {
                if (player.ownedProjectileCounts[ModContent.ProjectileType<Probe>()] <= 0)
                {
                    Projectile.NewProjectile(null, player.Center.X, player.Center.Y, Main.rand.Next(-9, 9), Main.rand.Next(-9, 9), ModContent.ProjectileType<Probe>(), 0, 0f, player.whoAmI, 0f, 0f);
                    Projectile.NewProjectile(null, player.Center.X, player.Center.Y, Main.rand.Next(-9, 9), Main.rand.Next(-9, 9), ModContent.ProjectileType<Probe>(), 0, 0f, player.whoAmI, 0f, 0f);
                    Projectile.NewProjectile(null, player.Center.X, player.Center.Y, Main.rand.Next(-9, 9), Main.rand.Next(-9, 9), ModContent.ProjectileType<Probe>(), 0, 0f, player.whoAmI, 0f, 0f);
                }
                player.GetModPlayer<AccPlayer>().probes = true;
            }
        }
    }
}
